#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;

const int N = 4e5 + 10;

int n, m;
vector<int> e[N];
int p[N];
int cnt[N];
bool st[N], vis[N];

int find(int x){
    if(x != p[x]){
        p[x] = find(p[x]);
    }
    return p[x];
}


bool dfs(int u, int fa){
    vis[u] = true;

    for(int i = 0; i < e[u].size(); i ++){
        if(e[u][i] == fa) continue;
        if(vis[e[u][i]]) return true;

        if(dfs(e[u][i], u)) return true;
    }

    return false;
}

int main(){
#ifdef LOCALFLAG
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif


    ios::sync_with_stdio(false);
    cin.tie(nullptr);


    int t1 = 0, t2 = 0;
    cin >> n >> m;
    for(int i = 1; i <= n * 2; i += 2){
        e[i].push_back(i + 1);
        e[i + 1].push_back(i);
        p[i] = i;
        p[i + 1] = i + 1;
    }
    // R: 1. B: 2
    int a, c;
    string b, d;
    for(int i = 1; i <= m; i ++){
        cin >> a >> b >> c >> d;
        if(a == c){
            st[a] = true;
            t1 ++;
            continue;
        }


        int ida, idc;
        if(b == "R"){
            ida = a * 2 - 1;
        }else{
            ida = a * 2;
        }

        if(d == "R"){
            idc = c * 2 - 1;
        }else{
            idc = c * 2;
        }

        e[ida].push_back(idc);
        e[idc].push_back(ida);

        int fa = find(a), fc = find(c);
        p[fa] = fc;
    }

    for(int i = 1; i <= n; i ++){
        int fa = find(i);
        // cout << "i: " << i << " fa: " << fa << " " << st[fa] << '\n';
        if(!st[fa]){
            bool ok = dfs(fa * 2, fa * 2);
            if(ok) t1 ++;
            else t2 ++;

            st[fa] = true;
        }
    }

    cout << t1 << " " << t2 << '\n';

    return 0;
}